from typing import Optional, Union, List

from pydantic import BaseModel, Field


class GenerateImageRecordSchemaReq(BaseModel):
    params: Union[dict, List[dict]] = Field(description='参数', default="{}")
    batch_count: Optional[int] = Field(description='批次', default=1)


class GenerateImageRecordSchemaCreate(BaseModel):

    params: Optional[str] = Field(description='参数', default="{}")
    number: int = Field(description="数量", default=1)
    user_id: Optional[int] = Field(default='用户ID')
    type: Optional[int] = Field(description="类型", default=1)
    state: Optional[int] = Field(description="状态", default=1)


class GenerateImageRecordSchemaRes(BaseModel):
    id: int = Field(description='ID')
    params: Optional[str] = Field(description='参数', default="{}")
    user_id: Optional[int] = Field(default='用户ID')
    number: Optional[int] = Field(default="数量")
    type: Optional[int] = Field(description="类型", default=1)
    state: Optional[int] = Field(description="状态", default=1)


class GenerateImageRecordSchemaDel(BaseModel):
    id: list[int] = Field(description='ID列表', default=[])


class GenerateResultImageCreate(BaseModel):
    record_id: int = Field(description="记录ID")
    path: str = Field(description="路径")


if __name__ == '__main__':
    dit = {"params": "", "batch_count": 1}
    print(GenerateImageRecordSchemaReq.validate(dit))




